

class UserController {

    def index = {}

    def login= {
        if(params.username=="asd" && params.password=="asd"){
            flash.message = "login succeed"
            session.user = params.username
        }else{
            flash.message = "login failed"
        }
        redirect(action: 'index')
    }
    def logout = {
        session.user=null
        redirect(action:'index')
    }
}
